package nc.bs.dm.m4804.pub;

 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import nc.bs.framework.common.NCLocator;
 import nc.itf.dm.m4804trantype.IM4804TranTypeService;
 import nc.vo.dm.m4804.entity.DelivBillAggVO;
 import nc.vo.dm.m4804.entity.DelivBillHVO;
 import nc.vo.dm.m4804trantype.entity.M4804TranTypeVO;
 import nc.vo.pub.BusinessException;
 import nc.vo.pubapp.pattern.exception.ExceptionUtils;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 public class CachTranTypeUitl {
   public Map<String, M4804TranTypeVO> getTranTypesByBills(DelivBillAggVO[] vos) {
     Map<String, M4804TranTypeVO> result = null;
     Set<String> ids = new HashSet<>();
     String pk_group = vos[0].getParentVO().getPk_group();
     try {
       for (DelivBillAggVO vo : vos) {
         DelivBillHVO hvo = vo.getParentVO();
         if (hvo.getVtrantypecode() == null && hvo.getCtrantypeid() != null) {
 
           String vtrantcode = ((IM4804TranTypeService)NCLocator.getInstance().lookup(IM4804TranTypeService.class)).queryTranTypeCodeByIdGroup(hvo.getCtrantypeid(), hvo.getPk_group());
           hvo.setVtrantypecode(vtrantcode);
         } 
         ids.add(hvo.getVtrantypecode());
 
       } 
       result = ((IM4804TranTypeService)NCLocator.getInstance().lookup(IM4804TranTypeService.class)).queryTranType(ids.<String>toArray(new String[ids.size()]), pk_group);
     } catch (BusinessException e) {
       ExceptionUtils.wrappException((Exception)e);
     } 
     return result;
   }
 }
